#include <iostream>

using namespace std;

struct pay
{
    char name[10];
    char terminal[10];
    char ope[10];
    char issuer[10];
    char validity[10];
    char number[20];
    char day[10];
    char money[10];
};

int main()
{
    int t;
    cin >> t;

    pay *card = new pay[t];
    int n = t;

    for (int i = 0; i < t; i++)
    {
        cin >> card[i].name;
        cin >> card[i].terminal;
        cin >> card[i].ope;
        cin >> card[i].issuer;
        cin >> card[i].validity;
        cin >> card[i].number;
        cin >> card[i].day;
        cin >> card[i].money;
        cout << "Name: " << card[i].name << endl;
        cout << "Terminal: " << card[i].terminal;
        cout << " operator: " << card[i].ope << endl;
        cout << "Card Issuers: " << card[i].issuer;
        cout << " Validity: " << card[i].validity << endl;
        cout << "CardNumber: ";
        for (int j = 0; j < 4; j++)
        {
            cout << card[i].number[j];
        }
        cout << "********";
        for (int j = 12; j < 16; j++)
        {
            cout << card[i].number[j];
        }
        cout << endl;
        cout << "Traded: " << card[i].day << endl;
        cout << "Costs: $" << card[i].money << endl;
        if (i != t - 1)
        {
            cout << endl;
        }
    }

    return 0;
}